package com.sanno.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration      //表示该类是配置类
public class SwaggerConfig {

    @Bean
    public Docket docket(){
        //创建一个Docket对象
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        //创建Api接口信息对象
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("Swagger[Api接口文档]") // 标题
                .description("描述文字") // 描述
                .contact(new Contact("消愁", "http://", "")) // 联系方式
                .version("1.0") // 版本号
                .build();
        //指定docket的ApiInfo
        docket.apiInfo(apiInfo);
        return docket;
    }
}